package com.hq.service;

import com.hq.bean.City;
import com.hq.bean.Student;
import com.hq.dao.StuDAO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class StuServiceImpl implements StuService {

    @Resource
    private StuDAO stuDAO;

    @Override
    public List list(Map map) {
        return stuDAO.list(map);
    }

    @Override
    public List<City> cityList(Integer pid) {
        return stuDAO.cityList(pid);
    }

    @Override
    public List courseList() {
        return stuDAO.courseList();
    }

    @Override
    public int addStu(Student student, Integer[] cids) {
        int i=stuDAO.addStu(student);
        if(cids!=null){
            Map map=new HashMap();
            map.put("sid",student.getSid());
            map.put("cids",cids);
            stuDAO.addMi(map);
        }
        return i;
    }
}
